﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace MDigman.Camera.Media.Copier.WPF
{
    /// <summary>
    /// Interaction logic for Settings.xaml
    /// </summary>
    public partial class Settings : Window
    {
        public Settings()
        {
            InitializeComponent();
        }

        private void OK_Clicked(object sender, RoutedEventArgs e)
        {
            DialogResult = true;
            Close();
        }

        public string ImageFormat
        {
            set
            {
                string val = string.Format("img{0}", value);
                foreach (ComboBoxItem item in fmtImage.Items)
                {
                    if (item.Name.Equals(val))
                    {
                        fmtImage.SelectedValue = item;
                        break;
                    }
                }
            }
            get
            {
                ComboBoxItem item = (ComboBoxItem)fmtImage.SelectedValue;
                if (item != null)
                {
                    return item.Name.Substring(3);
                }
                else
                {
                    return string.Empty;
                }
            }
        }

        public string VideoFormat
        {
            set
            {
                string val = string.Format("vid{0}", value);
                foreach (ComboBoxItem item in fmtVideo.Items)
                {
                    if (item.Name.Equals(val))
                    {
                        fmtVideo.SelectedValue = item;
                        break;
                    }
                }
            }
            get
            {
                ComboBoxItem item = (ComboBoxItem)fmtVideo.SelectedValue;
                if (item != null)
                {
                    return item.Name.Substring(3);
                }
                else
                {
                    return string.Empty;
                }
            }
        }

        public bool OverwriteFiles
        {
            set { cbOverwrite.IsChecked = value; }
            get { return Convert.ToBoolean(cbOverwrite.IsChecked); }
        }

        public bool ShowVideoImages
        {
            set { cbShowVideo.IsChecked = value; }
            get { return Convert.ToBoolean(cbShowVideo.IsChecked); }
        }
    }
}
